var nowDate = getDay(0);
var pandianid = GetQueryString('pandianid');
var shopcode = sessionStorage.getItem("shopcode");
var userId = sessionStorage.getItem("userId");
function ICalendarClick(){
	
}
$(document).ready(function(){
/*	alert(sessionStorage.getItem("reload"));*/
    if(sessionStorage.getItem("reload")=='true'){
	     window.location.reload();
		sessionStorage.setItem("reload", false);
	}else{
//		getPandianJieguoBiaozhun();
		
		$('#name').text(sessionStorage.getItem("name"));
		$('#saveButton').on('click',saveInfo);
		addPandianJieguoBiaozhun()
	}
	
	
});
function saveInfo(){
	showloading();
	try {
		var sendData = {};
		
		var checkFlag = true;
		sendData.shopcode = $('#shopcode').val();
		if(sendData.shopcode == ''){
			layer.msg("门店编号不能为空");
			checkFlag = false;
			return false;
		}
		sendData.lrr = userId;
		sendData.pandianDate = nowDate;
//		alert(checkFlag)
		if(checkFlag){
			$.ajax({
				url: "../pandianevery/insertPandianJianchajinji"
				,type:'post'
				,dataType:'json'
				,async: false
				,contentType: "application/json; charset=utf-8"
				,data:JSON.stringify(sendData) 
				,success: function(res){
					console.log(res)
					if(res.success){
						history.go(-1);
					}else{
						hideloading();
						layer.alert(res.message);
					}
				}
		    });
		}
		
/*		console.log(insertArray.length);*/
	} catch (e) {
		console.log(e)
	} finally{
		hideloading();
	}	
	
}	


function addPandianJieguoBiaozhun(){
	
	$('#f_div').append('<div class="col_box" >'
					+'		<div class="widget-box add_mar_tb7p" itemDiv="0">'
					+'			<div class="widget-header widget-header-flat widget-header-small add_pad_tb10p add_bor_tbgrey">'
					+'				<h5><i class="iconfont">&#xe600;</i>&nbsp;店号</h5><span class="red">*</span>'
					+'				<input type="text" id="shopcode" placeholder="请输入门店编号" autocomplete="off"   class="pull-right add_bor_none" style="width: 70%;margin-right: 2%"/>'
					+'			</div>'
					+'		</div>'	
					+'</div>');
}



